﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Intranet.Models.activity>" %>
<div id='<%=string.Format("activity_{0}",Model.id) %>'>
    <div class="activityBanner">
        <div class="activityDate">
            This activity is due by
            <%=Model.dueDate.Date.ToShortDateString() %>
        </div>
        <div class="activityDetails">
            <a href='<%: Url.Action("Index", new { id = Model.id })%>'>
                <h2>
                    <%=Model.details%></h2>
            </a>
        </div>
    </div>
    <div class="activityCommands">
        <a href="#" id="button<%=Model.id %>" onclick="revealNew('button<%=Model.id %>','child<%=Model.id %>')"
            class="effectButton">Show children</a>
        <%: Ajax.ActionLink("Delete", "Delete", new { id = Model.id }, new AjaxOptions { UpdateTargetId = string.Format("activity_{0}", Model.id), InsertionMode = InsertionMode.Replace, OnSuccess = string.Format("deleteActivityNode('#activity_{0}')", Model.id) })%>
    </div>
    <div class="childActivities" id="child<%=Model.id %>">
        <div class="childrenBanner" id="new<%=Model.id %>">
        </div>
        <div class="divIndent">
            <% foreach (var item in Model.activities1)
               {
                   if (!item.isDeleted)
                   {
                       Html.RenderPartial("ParentActivity", item);
                   }
               }%>
            <% using (Ajax.BeginForm("NewActivity", "Home", new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "myActivities", OnComplete = "clearText" }))
               {%>
            <%: Html.ValidationSummary(true)%>
            <div id="createTask">
                <%: Html.HiddenFor(model => model.assignedTo)%>
                <%: Html.HiddenFor(model => model.id)%>
                <input class="activityTextBox" name="NewActivity.details" id="NewActivityDetails"
                    type="text" placeholder="create child activity" />
                <input type="submit" value="Create" />
            </div>
            <%} %>
        </div>
    </div>
</div>
<!-- the new activity-->
